<template>
  <div id="app">
    <h2>测试题</h2>
    <Subject
      v-for="(arr,index) in list"
      :key="index"
      :index='index'
      @result='resultFn'
    ></Subject>
    <div>
      <Flag
        v-for="(result,index) in list"
        :key='index'
        :result='result'
        :index='index'
      ></Flag>
    </div>
  </div>
</template>

<script>
import Subject from './components/Subject'
import Flag from './components/Flag'
export default {
  components: {
    Subject,
    Flag
  },
  data () {
    return {
      list: ['未完成', '未完成', '未完成', '未完成', '未完成']
    }
  },
  methods: {
    resultFn (resultStr, index) {
      this.$set(this.list, index, resultStr)
    }
  }
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>